$space: 10;
$spaces: map-merge(
  $map1: (
    0: 0px,
    1: 1 * $space + px,
    2: 2 * $space + px,
    3: 3 * $space + px,
  ),
  $map2: (
    4: 4 * $space + px,
  ),
);
$uitls: map-merge(
  $map1: (
    p: (
      property: padding,
      values: $spaces,
    ),
    m: (
      property: margin,
      values: $spaces,
    ),
    mx: (
      property: margin-left margin-right,
      values: $spaces,
    ),
    mt: (
      property: margin-top,
      values: $spaces,
    ),
  ),
  $map2: (),
);
@each $key, $value in $uitls {
  $values: map-get(
    $map: $value,
    $key: values,
  );
  $properties: map-get(
    $map: $value,
    $key: property,
  );
  @each $item-key, $item-value in $values {
    .#{$key}-#{$item-key} {
      @each $var in $properties {
        #{$var}: $item-value;
      }
    }
  }
}

// @each $key, $value in $spaces {
//   .p-#{$key} {
//     padding: $value;
//   }
// }
